package servlet.buyShopping;

import com.google.gson.Gson;
import dao.UserDao;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@WebServlet(name = "QueryAddressServlet", value = "/QueryAddressServlet.s")
public class QueryAddressServlet extends HttpServlet {
    private UserDao dao = new UserDao();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        final String uid = request.getParameter("uid");
        final List<Map<String, Object>> data = dao.findAdress(uid);
        final String json = new Gson().toJson(data);
        response.getWriter().append(json);

    }
}
